<template>
    <div>

        <el-card class="box-card">

            <el-form label-width="150px">
                <el-row type="flex" class="row-bg">

                    <el-col :span="6">
                        <el-form-item label="责任名称:">
                            <el-select v-model="model.INTEREST_ORDEROTHER_NAME" placeholder="请选择">
                                <el-option v-for="item in duty" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                    <el-col :span="6">
                        <el-form-item label="保险金额:">
                            <el-input v-model="model.INTEREST_ORDEROTHER_MONEY" placeholder="保险金额"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div class="space20">
            </div>
           
            <el-card class="box-card">
                <div slot="header" class="card-heaer">
                    <span style="line-height: 36px;">责任项</span>
                </div>
                <div :key="data.IPOTHER_ITEM_ID" v-for="data in model.IO_OTHER_ITEM ">
                    <el-form label-width="150px">
                        <el-row type="flex" class="row-bg">
                            <el-col :span="6">
                                <el-form-item label="保险项名称:">                                    
                                    <el-input v-model="data.IO_OTHER_ITEM_NAME" placeholder="保险项名称"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="保险金额:">
                                    <el-input v-model="data.IO_OTHER_ITEM_MONEY" placeholder="保险金额"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6" v-if="model.INTEREST_ORDEROTHER_NAME=='全球紧急救援保险责任'">
                                <el-form-item label="单次自付额:">
                                    <el-input v-model="data.IO_OTHER_ITEM_ZFMONEY" placeholder="单次自付额"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="6" v-if="model.INTEREST_ORDEROTHER_NAME=='全球紧急救援保险责任'">
                                <el-form-item label="单项给付比例:">
                                    <el-input v-model="data.IO_OTHER_ITEM_ZFBL" placeholder="单项自付比例"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </div>
            </el-card>
        </el-card>
    </div>
</template>
<script>
import {
    mapState
} from 'vuex';
import getid from '@/js/getid';
export default {
    data() {
        return {
            producename: [],
            IPOTHER_ID: "",
            produce: [],
            IPOTHER_NAME: "",
            IPOTHER_MONEY: "",
            PRODUCTNO: "",
            duty: [{
                "value": "意外伤害保险责任",
                "label": "意外伤害保险责任"
            },
            {
                "value": "全球紧急救援保险责任",
                "label": "全球紧急救援保险责任"
            },
            {
                "value": "学业中断保险责任",
                "label": "学业中断保险责任"
            },
            {
                "value": "旅行不便保险责任",
                "label": "旅行不便保险责任"
            },
            {
                "value": "个人第三者保险责任",
                "label": "个人第三者保险责任"
            }
            ]


        };
    },
    props: {
        model: {
            type: Object,
            default: {}
        }
    },
    methods: {
        // submitForm() {
        //     var model = {
        //         IPOTHER_ID: this.IPOTHER_ID,
        //         IPOTHER_NAME: this.IPOTHER_NAME,
        //         IPOTHER_MONEY: this.IPOTHER_MONEY,
        //         PRODUCTNO: this.PRODUCTNO,
        //         IPOTHER_ITEM: this.produce
        //     }
        //     this.$http.put("Interest_ProduceOther", model).then(response => {
        //         var data = response.body;
        //         if (data.code == 1) {
        //             this.$notify.success({
        //                 title: '提交成功',
        //                 message: '提交成功'
        //             });
        //         } else {
        //             this.$notify.error({
        //                 title: '提交失败',
        //                 message: '提交失败'
        //             });
        //         }
        //     }, response => {
        //         this.$notify.error({
        //             title: '网络错误',
        //             message: '网络错误'
        //         });

        //     });

        // },
        adddata() {
            this.produce.push({
                IPOTHER_ITEM_ID: getid.getid(),
                IPOTHER_ITEM_NAME: "",
                IPOTHER_ITEM_MONEY: "",
                IPOTHER_ITEM_ZFMONEY: "",
                IPOTHER_ITEM_ZFBL: ""
            });

        },
        delect(index) {
            if (index > -1) {
                this.produce.splice(index, 1);
            }
        }



    },
    activated() {
        this.$http.get("LZ_SAM_INSURPRODDEF").then(response => {
            var data = response.body;
            this.producename = data;
        }, response => {
            this.$notify.error({
                title: '网络错误',
                message: '网络错误'
            });
        });
        // this.$http.get("Interest_ProduceOther/" + this.$route.query["id"]).then(response => {
        //     var data = response.body;
        //     if (data.code == 1) {
        //         this.IPOTHER_ID = data.result[0].IPOTHER_ID,
        //             this.IPOTHER_NAME = data.result[0].IPOTHER_NAME,
        //             this.IPOTHER_MONEY = data.result[0].IPOTHER_MONEY,
        //             this.PRODUCTNO = data.result[0].PRODUCTNO;
        //         this.produce = data.result[0].IPOTHER_ITEM;
        //     }
        // }, response => {
        //     this.$notify.error({
        //         title: '网络错误',
        //         message: '网络错误'
        //     });

        // });
    }

}
</script>
